home *** CD-ROM | disk | FTP | other *** search
- *----------------------------------------------------------------------
- *
- * Startup code rewritten and optimized by K.C. Nilsen.
- *
- * Do not need any includes.
- * Use this in the beginning of your source (1.label called Start)
- * This routine makes programs work fine even if they where
- * started from Workbench (Icon...).
- *
- *----------------------------------------------------------------------
-
- StartUp movem.l d0/a0,-(sp)
- lea $0.w,a1
- move.l $4.w,a6
- jsr -294(a6) find task (this task)
- move.l d0,a4
- tst.l 172(a4) test if started from CLI
- beq.b .WB was launched from Workbench
- movem.l (sp)+,d0/a0
- bra.b .End
- .WB lea 92(a4),a0 message port
- jsr -384(a6) wait port
- lea 92(a4),a0
- jsr -372(a6) get message
- move.l d0,RtnMess
- movem.l (sp)+,d0/a0
-
- .End bsr.w Start start our program
- move.l d0,-(sp)
- tst.l RtnMess any message ?
- beq.w .DOS no > exit to DOS
- move.l $4.w,a6
- jsr -132(a6) forbid
- move.l RtnMess(pc),a1 give back message pointer
- jsr -138(a6) permit
- .DOS move.l (sp)+,d0
- rts exit to DOS
- RtnMess dc.l 0
-